/* Copyright 203-2115 AtomWare Technology Pty Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * The flowing information must be keep 
 * UserInfoMessage.java
 * identity
 * 2014年2月16日下午5:32:00
 * @author 屈甲康
 * QQ285799123
 * mailto:qujiakang@gmail.com
 */

package org.jackysoft.entity.nosql;

import java.util.List;

import org.mongodb.morphia.annotations.Embedded;

@Embedded
public class UserInfo extends AbstractEmbedded {

	private String name;
	private String localName;
	private @Embedded
	NameValuePair group;
	private @Embedded
	NameValuePair role;
	private List<NameValuePair> authorties;

	public static final UserInfo PUBLIC = new UserInfo() {

		{
			setName("PUBLIC");
			setLocalName("大厅");
		}

	};

	public UserInfo() {
		this.pattern = "<li><span class='label label-inverse'>%s</span></li>";
	}

	public UserInfo(NameValuePair np){
		this();
		this.name = np.getName();
		this.localName = np.getValue();
	}
	
	public String getName() {
		return name;
	}

	public String getLocalName() {
		return localName;
	}

	public NameValuePair getGroup() {
		return group;
	}

	public NameValuePair getRole() {
		return role;
	}

	public List<NameValuePair> getAuthorties() {
		return authorties;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setLocalName(String localName) {
		this.localName = localName;
	}

	public void setGroup(NameValuePair group) {
		this.group = group;
	}

	public void setRole(NameValuePair role) {
		this.role = role;
	}

	public void setAuthorties(List<NameValuePair> authorties) {
		this.authorties = authorties;
	}
}
